package com.linkwechat.common.vo;

import com.linkwechat.common.enums.ResponseEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * @Author 王君平
 * @Date 2023/8/28 14:28
 * @Description
 */
@Data
public class CommonRsp<T> implements Serializable {

    /**
     * @see ResponseEnum
     */
    @ApiModelProperty(value="响应状态码 ",dataType = "int")
    private Integer code;

    @ApiModelProperty(value="响应的消息  一般失败的时候才有",dataType = "string")
    private String msg;

    @ApiModelProperty(value="响应的数据",dataType = "[] | {}")
    private T data;

    public CommonRsp(){}

    public CommonRsp(Integer code, String msg, T data){
        this.code =code;
        this.msg = msg;
        this.data = data;
    }

    public CommonRsp(ResponseEnum enu, T data){
        this.code = enu.getCode();
        this.msg = enu.getMsg();
        this.data = data;
    }
}
